package com.example.chatroom.controller;

import com.example.chatroom.service.ChatService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 聊天室主要功能
 * @author :ld
 * @date :2021/7/13
 */
@RestController
@RequestMapping("chat")
@Api(tags = "聊天室")
public class ChatRoomController {
    @Autowired
    private ChatService chatService;

    @GetMapping("jionRoom")
    @ApiOperation("加入聊天室")
    public String jionRoom(String roomId,String userId){
        return chatService.jionRoom(roomId,userId);
    }

    @GetMapping("leaveRoom")
    @ApiOperation("离开聊天室")
    public String leaveRoom(String roomId,String userId){
        return chatService.leaveRoom(roomId,userId);
    }

    @GetMapping("createRoom")
    @ApiOperation("创建聊天室")
    public String createRoom(String roomId){
        return chatService.createRoom(roomId);
    }

    @GetMapping("createUser")
    @ApiOperation("创建用户")
    public String createUser(String userId){
        return chatService.createUser(userId);
    }
}
